package com.longlong.yfbank.entity.vo;

import lombok.Data;

/**
 * @author longlong
 * @date 2024-01-06 14:40
 * description
 */
@Data
public class ResponseVo<T> {

    private Integer code ;

    private String msg ;

    private T data;

    public ResponseVo(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ResponseVo(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public  static <T> ResponseVo<T> success(T data){
        return new ResponseVo<>(200,"success",data);
    }

    public  static <T> ResponseVo<T> success(){
        return new ResponseVo<>(200,"success");
    }

    public  static <T> ResponseVo<T> error(String msg) {
        return new ResponseVo<>(500, msg);

    }
}
